package com.htrq.service;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.htrq.dao.ICKJhDao;
import com.htrq.entity.ICKJhx;
import com.htrq.entity.Page;

@Service
@Transactional(value = "txManager2")
public class ICardjhService {
	@Resource
	private ICKJhDao jhDao;

	public List<ICKJhx> getAllkjh(ICKJhx jh, Page page) throws ParseException {
		// TODO Auto-generated method stub
		List<Object[]> list = jhDao.getAllkjh(jh, page);
		List<ICKJhx> jhs = new ArrayList<ICKJhx>();
		for (Object[] obj : list) {
			ICKJhx hx = new ICKJhx();
			hx.setAutoId(obj[0].toString());
			hx.setCardNumber(obj[1].toString());
			hx.setLastBalance(obj[2].toString());
			hx.setCurrBalance(obj[3].toString());
			hx.setJhDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(obj[4].toString()));
			hx.setRoutId(obj[5].toString());
			hx.setUserName(obj[6].toString());
			hx.setNodeName(obj[7].toString());
			hx.setJhnodeName(obj[8].toString());
			hx.setNote(obj[9].toString());
			jhs.add(hx);
		}
		return jhs;
	}
	public Long getTotal(ICKJhx jh) {
		// TODO Auto-generated method stub
		return jhDao.getTotal(jh);
	}
	public List<Object[]> exportbyForm(ICKJhx jhx) {
		//TODO Auto-generated method stub
		return jhDao.exportbyForm(jhx);
	}
}
